<template>
  <div class="box">
    <div class="top">
      <p class="title">实时游客统计</p>
      <p class="bg"></p>
      <p class="right">可预约总量<span>9999</span>人</p>
    </div>
    <div class="number">
      <span v-for="(i, index) in people" :key="index">{{ i }}</span>
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<script setup lang="ts">
import "echarts-liquidfill"; //引入水球图，水球图是一个插件，需要单独安装引用
import * as echarts from "echarts";
import { onMounted, ref } from "vue";
let people = ref("216908人");
let charts = ref();

onMounted(() => {
  let $echart = echarts.init(charts.value);
  $echart.setOption({
    title: {
      // text:'游客统计'
    },
    // xAxis:{},
    // yAxis:{},
    grid: { top: 10, right: 10, bottom: 10, left: 10 },
    series: {
      type: "liquidFill",
      data: [0.6, 0.4, 0.2],
      radius: "90%",
    },
  });
});
</script>

<style scoped lang="scss">
.box {
  margin-top: 10px;
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;

  .top {
    .title {
      color: white;
      font-size: 20px;
      margin-left: 20px;
      margin-top: 10px;
    }

    .bg {
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
      margin-top: 10px;
      margin-left: 20px;
    }

    .right {
      float: right;
      color: white;
      font-size: 20px;
      margin-right: 10px;

      span {
        color: yellowgreen;
      }
    }
  }

  .number {
    margin-top: 30px;
    padding: 10px;
    display: flex;

    span {
      flex: 1;
      height: 50px;
      text-align: center;
      line-height: 50px;
      background: url(../../images/total.png) no-repeat;
      background-size: 100% 100%;
      color: #29fcff;
      font-weight: bold;
      font-size: 25px;
    }
  }

  .charts {
    width: 100%;
    height: 250px;
  }
}
</style>
